# 
# 
# Author: Guochun Shen
# Data:   2011-12-18
# Project:spatial statistic
# Email:  shenguochun@gmail.com
###############################################################################


test.auto_mark_apply=function(){
	mydata("phylo_mark_data")
	tp=auto_mark_apply(data.ppp,mark="sp", function(x) x$n)
	re=unlist(tp)
	mark=get_marks(data.ppp,marks="sp")
	checkEquals(length(re),length(unique(mark)))
	checkEquals(as.numeric(sort(re)),sort(as.numeric(table(mark))))
	status=get_marks(data.ppp,marks="status")
	cond=status=="A" || status=="AB"
	re2=auto_mark_apply(data.ppp,mark="sp",FUN=partial_rthin,
			P=0.8,condition=cond)
	checkEquals(length(re2),length(unique(mark)))
}
